package com.als.healthymananger.controller;


import com.als.healthymananger.entity.Suggestion;
import com.als.healthymananger.utils.RespBean;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Tag(name = "知识库-健康方案", description = "增删改查")
public interface SuggestionsApi {
    /**
     * 添加健康方案
     */
    @PostMapping("/")
    @Operation(summary = "添加健康方案", description = "添加健康方案", security = @SecurityRequirement(name = "bearer-key"))
    @Parameter(name = "suggestion", description = "健康信息", in = ParameterIn.QUERY, schema = @Schema(ref = "suggestion"), required = true)
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "添加成功"),
            @ApiResponse(responseCode = "400", description = "添加失败"),
            @ApiResponse(responseCode = "401", description = "用户未登录"),
            @ApiResponse(responseCode = "403", description = "权限不足"),
            @ApiResponse(responseCode = "412", description = "先决条件不足，如数据格式不对")
    })
    public RespBean createSuggestions(@RequestBody @Validated Suggestion suggestion);

    /**
     * 删除健康方案
     */
    @DeleteMapping("/{suggestionId}")
    @Operation(summary = "删除健康方案", description = "删除健康方案", security = @SecurityRequirement(name = "bearer-key"))
    @Parameter(name = "suggestionId", description = "健康方案序列", in = ParameterIn.PATH, required = true)
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "删除成功"),
            @ApiResponse(responseCode = "400", description = "删除失败"),
            @ApiResponse(responseCode = "401", description = "用户未登录"),
            @ApiResponse(responseCode = "403", description = "权限不足"),
            @ApiResponse(responseCode = "412", description = "先决条件不足，如数据格式不对")
    })
    public RespBean deleteSuggestions(@PathVariable("suggestionId")int suggestionId);

    /**
     * 修改健康方案
     */
    @PutMapping("/{suggestionId}")
    @Operation(summary = "修改健康方案", description = "修改健康方案", security = @SecurityRequirement(name = "bearer-key"))
    @Parameters({
            @Parameter(name = "suggestionId", description = "健康方案序列", in = ParameterIn.PATH, required = true),
    })
    @Parameter(name = "sport", description = "运动项目信息", in = ParameterIn.QUERY, schema = @Schema(ref = "suggestion"), required = true)
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "修改成功"),
            @ApiResponse(responseCode = "400", description = "修改失败"),
            @ApiResponse(responseCode = "401", description = "用户未登录"),
            @ApiResponse(responseCode = "403", description = "权限不足"),
            @ApiResponse(responseCode = "412", description = "先决条件不足，如数据格式不对")
    })
    public RespBean updateSuggestions(@PathVariable("suggestionId")int suggestionId,
                                @RequestBody @Validated Suggestion suggestion);

    /**
     * 获取健康方案信息
     */
    @GetMapping("/{suggestionId}")
    @Operation(summary = "获取健康方案信息", description = "获取健康方案信息", security = @SecurityRequirement(name = "bearer-key"))
    @Parameter(name = "suggestionId", description = "健康方案序列", in = ParameterIn.PATH, required = true)
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "获取成功"),
            @ApiResponse(responseCode = "400", description = "获取失败"),
            @ApiResponse(responseCode = "401", description = "用户未登录"),
            @ApiResponse(responseCode = "403", description = "权限不足"),
            @ApiResponse(responseCode = "412", description = "先决条件不足，如数据格式不对")
    })
    public RespBean getSuggestions(@PathVariable("suggestionId")int suggestionId);
}
